<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="__PUBLIC__/home/css/cancellation-of-order.css" />
		<script src="__PUBLIC__/home/js/jquery-1.12.2.min.js"></script>
		<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
		<title>订单管理</title>
	</head>
	<script type="text/javascript">
		var pageStartTime = +new Date;
		~
		function(e) {
			function t() {
				var t = screen.width > 0 && (e.innerWidth >= screen.width || 0 == e.innerWidth) ? screen.width : e.innerWidth;
				a && (t = screen.width);
				var i = t > u ? w : t / (u / 100);
				i = i > h ? i : h, document.documentElement.style.fontSize = i + "px"
			}
			var i, n = e.navigator.userAgent,
				a = n.match(/iphone/i),
				o = n.match(/yixin/i),
				c = n.match(/Mb2345/i),
				r = n.match(/mso_app/i),
				s = n.match(/sogoumobilebrowser/gi),
				m = n.match(/liebaofast/i),
				d = n.match(/GNBR/i),
				u = document.documentElement.dataset.dw || 720
			h = 42,
				w = 100;
			e.addEventListener("resize", function() {
				clearTimeout(i), i = setTimeout(t, 300)
			}, !1), e.addEventListener("pageshow", function(e) {
				e.persisted && (clearTimeout(i), i = setTimeout(t, 300))
			}, !1), o || c || r || s || m || d ? setTimeout(function() {
				t()
			}, 500) : t()
		}(window);
	</script>
	<body>
		<div class="header pr">
			<a href="javascript:history.back(-1)" class="icon pa">
				<img src="__PUBLIC__/home/img/back1.png">
			</a>		
			<span class="text-phone">订单管理</span>
		</div>
		<div class="indent">
			<div class="big-img pr">
				<div class="indent-header clearfix">
					<span class="pa indent-img">
						<img src="__PUBLIC__/home/img/健身-(1).png">
					</span>
					<p class="indent-meta"><span class="p-big">{$show['title']}</span><br>
					<span class="p-smale">订单时间: {$order['or_time']}</span></p>
				</div>
				<div class="indent-center pr">
					<p class="waiting"><span class="waiting-img pa"><img src="__PUBLIC__/home/img/wait_03.png"></span><span>订单号: {$order['order_id']}</span></p>
				</div>
				<div class="indent-footer">
					<center>
					</center>
				</div>
			</div>
		</div>
		<div class="take">
			<div class="take-top">
				<p><span><img src="__PUBLIC__/home/img/icon-1.png"></span><span class="accept">收货人信息</span></p>
			</div>
			<div class="take-bottom">
				<div class="take-bottom-main">
					<p class="take-main-top"><span class="main-left fl">收货人: {$addr['name']}</span><span class="main-right fr">{$addr['tel']}</span></p>
					<p>收货地址 : {$addr['addr']}</p>
				</div>
			</div>
		</div>
		<div class="main-center"></div>
		<div class="take top-1">
			<div class="take-top take-top-1">
				<p><span><img src="__PUBLIC__/home/img/icon-2.png"></span><span class="accept">套餐</span></p>
			</div>
			<div class="take-bottom-main-1">
				<div class="bottom-img fl">
					<div class="img-left fl">
						<img src="__PUBLIC__/home/img/small01.png">
					</div>
					<div class="img-right fl">
						<p>{$order['name']} &nbsp;{$order['headline']}</p>
						<p>{$order['abstract']} &nbsp;{$order['conf_infor']}</p>
						<!-- <p>配送费：{$order['freight']}元</p> -->
						<p class="red-text" id="rest"></p>
					</div>	
				</div>
				<div class="bottom-img-right fr">
					<p class="tr price">¥ {$order['price']}元</p>
					<p class="tr small-number">X1</p>
				</div>
			</div>
		</div>
		<div id="mask" style="display:none;background-color: #000;z-index: 1040;left: 0;opacity: 0.5; position: fixed;top: 0;right: 0; bottom: 0;"></div>
		<div class="alert pr">
			<img src="__PUBLIC__/home/img/close.png" class="pa close">
			<div class="alert-top">
				<p class="big-text">是否在同一个小区</p>
				<p class="small-text">*同一个小区:转租成功后系统将自动返还您的配送费</p>
				<p class="small-text">不同一个小区:系统不会返还您的配送费</p>
			</div>
			<div class="alert-bottom">
				<div class="fl yes">是</div>
				<div class="fr no">否</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
	$(document).ready(function() {
		var state = '{$show["state"]}';
		var appendButton = '';
		if(state == '2' || state == '3') {
			if(state == '2') {
				appendButton = '<input type="button" class="relet button-one fl" value="续租" style="margin-left:.4rem">&nbsp;&nbsp;'
						     + '<input type="button" class="sublet button-one" value="一键转租">&nbsp;&nbsp;'
							 + '<input type="button" class="back button-one fr" value="我要还货" style="margin-right:.4rem">';
			} else if(state == '3') {
				appendButton = '<input type="button" class="button-one fr" value="已转租" style="margin-right:.4rem">';
			}
			var endDate = '{$order["xd_time"]}';
			endDate = new Date(endDate);
			var curDate = new Date;
			var rest = endDate.valueOf() - curDate.valueOf();
			rest = Math.ceil(rest/24/60/60/1000);
			$('#rest').text('剩余天数: '+ rest +'天');
		} else {
			if(state == '0') {
				appendButton = '<input type="button" class="cancel button-one" value="取消订单">';
			} else if(state == '1') {
				appendButton = '<input type="button" class="prompt button-one" value="催单">';
			}
			$('#rest').text('剩余天数: {$g_price["time"]}天');
		}
		$('center').append(appendButton);
			wx.config({
				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: '{$wx["appId"]}', // 必填，公众号的唯一标识
				timestamp:'{$wx["timestamp"]}', // 必填，生成签名的时间戳
				nonceStr: '{$wx["nonceStr"]}', // 必填，生成签名的随机串
				signature: '{$wx["signature"]}',// 必填，签名，见附录1
				jsApiList: ['onMenuShareAppMessage','onMenuShareTimeline'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
		 	});
		 	wx.ready(function(){
			  //分享给朋友
				wx.onMenuShareAppMessage({
					title: "{$goods['abstract']}", // 分享标题 此处$title可在控制器端传递也可在页面传递 页面传递讲解在下面哦
					desc: '产品详情页', //分享描述
					link: "{$host}{:U('home/index/product_det?g_id='.$goods_id.'')}", // 分享链接
					imgUrl: 'http://wx.qlogo.cn/mmopen/vi_32/4NOsUrdClqPPZFcgQbiaT8tDeWxX3MpFM3aQvfqP365vBHddHhchEMc8ABdZuqDj13o7Ry6jIuEOANvIUktuPiag/0', // 分享图标
					type: 'link', // 分享类型,music、video或link，不填默认为link
					dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
					success: function () {
						alert('分享成功');
					},
					cancel: function () {
					// 用户取消分享后执行的回调函数
					// alert('取消分享');
					}
				});
				//分享到朋友圈
				wx.onMenuShareTimeline({
					title: '123', // 分享标题
					desc: 'ww3', // 分享描述
					link: "{$host}{:U('home/index/product_det?g_id='.$goods_id.'')}", // 分享链接
					imgUrl: 'http://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKZ0Zcsva3Pl6WmJ1IdqJ7ichY5BJn8EibmZahScD8AbaZnTYO5TZ35M4zTpHq9DC8J74vjVJV5GeXw/0', // 分享图标
					success: function () {
					// 用户确认分享后执行的回调函数
					},
					cancel: function () {
					// 用户取消分享后执行的回调函数
					}
				});
		 	});
		$('.relet').click(function() {
			window.location.href = "{:U('home/index/product_det?g_id='.$goods_id.'&relet='.$order['order_id'].'')}";
		})
		$('.cancel').click(function() {
			var con = confirm('是否取消订单');
			if(con) {
				window.location.href = "{:U('home/index/cancel_order',array('order_id' => $order['order_id']))}";
			}
		})
		$('.prompt').click(function() {
			
		})
	 	$('.yes, .no').click(function() {
			$("#mask").show();
			$('.header').prepend('<img id="arrow" style="width:110px;height:90px;margin-left:75%;position: fixed;float:right;z-index: 1050;" src="__PUBLIC__/home/img/share-arrow.png" />');
			$('.header').append('<img id="text" style="width:250px;height:250px;margin-left:15%;position: fixed;z-index: 1050;" src="__PUBLIC__/home/img/share-text.png" />');
		})
		$('#mask').on('click',function() {
			$('#arrow').remove();
			$('#text').remove();
			$('#mask').hide();
		})
		$('.close').click(function(){
			$(this).parent().hide();
		});
		$('.sublet').click(function(){
			$('.alert').show();
		})
	})
	</script>
</html>

